! function(e, t) {
	"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define
		.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).dtpweb = {})
}(this, (function(e) {
	"use strict";
	var t = function() {
		return t = Object.assign || function(e) {
			for (var t, n = 1, r = arguments.length; n < r; n++)
				for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[
					i]);
			return e
		}, t.apply(this, arguments)
	};
	"function" == typeof SuppressedError && SuppressedError;
	/**
	 * @file utils.ts
	 * @author DothanTech (hudianxing@dothantech.com)
	 * @brief PC JavaScript 版本 相关接口类型及方法定义。
	 * @version 2.1
	 * @date 2022-05-16
	 *
	 * @copyright Copyright (c) 2022
	 *
	 */
	var n, r, i, a, o, s, u, l, c, h, g, p, d, f, m, y, _, P, A, v, T, b, L, R = {
			METHOD_POST: "POST",
			METHOD_GET: "GET",
			IP: "127.0.0.1",
			PORT1: 15216,
			PORT2: 35216,
			TIME_OUT: 2e3,
			OUTER_TIME_OUT: 5e3,
			TIMEOUT_PRINT: 6e4,
			LABEL_WIDTH: 40,
			LABEL_HEIGHT: 30,
			FONT_NAME: "黑体",
			FONT_HEIGHT: 3.5,
			LINE_WIDTH: .35,
			DASH_LEN: [.5, .5],
			CORNER_RADIUS: 1.5,
			RADIUS: 5,
			RECT_WIDTH: 20,
			THRESHOLD: 192,
			PRINT_ACTION: 4096
		},
		I = "lpapi",
		N = "local",
		w = "Version",
		E = "SetSupportedPrinters",
		D = "GetDefaultPrinter",
		O = "SetDefaultPrinter",
		C = "DiscoveryPrinters",
		x = "GetPrinters",
		B = "OpenPrinter",
		S = "ClosePrinter",
		W = "IsPrinterOpened",
		M = "IsPrinterOnline",
		j = "GetPrinterName",
		H = "ShowProperty",
		k = "PrintImageD",
		U = "PrintRawData",
		F = "PrintPackage",
		q = "Print",
		K = "GetParam",
		V = "SetParam",
		J = "GetPrinterDPI",
		G = "SetItemOrientation",
		$ = "SetItemHorizontalAlignment",
		z = "SetItemVerticalAlignment",
		Y = "StartJob",
		Q = "AbortJob",
		X = "CommitJob",
		Z = "GetJobID",
		ee = "GetJobInfo",
		te = "GetPageInfo",
		ne = "GetPageImage",
		re = "StartPage",
		ie = "EndPage",
		ae = "ReturnDrawResult",
		oe = "DrawText",
		se = "Draw1DBarcode",
		ue = "Draw2DQRCode",
		le = "Draw2DPdf417",
		ce = "Draw2DDataMatrix",
		he = "DrawRectangle",
		ge = "DrawRoundRectangle",
		pe = "DrawEllipse",
		de = "DrawLine",
		fe = "DrawDashLine",
		me = "DrawImage",
		ye = "DrawImageD",
		_e = "ServerInfo",
		Pe = "application/x-www-form-urlencoded;charset=utf-8",
		Ae = "application/json;charset:utf-8",
		ve = "application/octet-stream;encoding=base64",
		Te = "application/octet-stream;encoding=hex16",
		be = "application/octet-stream",
		Le = "application/octet-stream;encoding=lz77",
		Re = "application/octet-stream;encoding=binary";
	e.LPA_ParamID = void 0, (n = e.LPA_ParamID || (e.LPA_ParamID = {}))[n.GapType = 1] = "GapType", n[n
			.PrintDarkness = 2] = "PrintDarkness", n[n.PrintSpeed = 3] = "PrintSpeed", n[n.PrinterDPIx = 4] =
		"PrinterDPIx", n[n.PrinterDPIy = 5] = "PrinterDPIy", e.LPA_GapType = void 0, (r = e.LPA_GapType || (e
			.LPA_GapType = {}))[r.Unset = 255] = "Unset", r[r.None = 0] = "None", r[r.Hole = 1] = "Hole", r[r
			.Gap = 2] = "Gap", r[r.Black = 3] = "Black", r[r.Trans = 4] = "Trans", e.LPA_PrintSpeed = void 0, (
			i = e.LPA_PrintSpeed || (e.LPA_PrintSpeed = {}))[i.Unset = 255] = "Unset", i[i.Min = 0] = "Min", i[i
			.Low = 1] = "Low", i[i.Normal = 2] = "Normal", i[i.High = 3] = "High", i[i.Max = 4] = "Max", e
		.LPA_PrintDarkness = void 0, (a = e.LPA_PrintDarkness || (e.LPA_PrintDarkness = {}))[a.Unset = 255] =
		"Unset", a[a.Min = 0] = "Min", a[a.Low = 3] = "Low", a[a.Normal = 5] = "Normal", a[a.High = 9] = "High",
		a[a.Max = 14] = "Max", e.LPA_ItemAlignment = void 0, (o = e.LPA_ItemAlignment || (e
		.LPA_ItemAlignment = {}))[o.Start = 0] = "Start", o[o.Center = 1] = "Center", o[o.End = 2] = "End", o[o
			.Stretch = 3] = "Stretch", o[o.Expand = 4] = "Expand", e.LPA_FontStyle = void 0, (s = e
			.LPA_FontStyle || (e.LPA_FontStyle = {}))[s.Regular = 0] = "Regular", s[s.Bold = 1] = "Bold", s[s
			.Italic = 2] = "Italic", s[s.BoldItalic = 3] = "BoldItalic", s[s.Underline = 4] = "Underline", s[s
			.Strikeout = 8] = "Strikeout",
		function(e) {
			e[e.None = 0] = "None", e[e.Char = 1] = "Char", e[e.Word = 2] = "Word"
		}(u || (u = {})),
		function(e) {
			e[e.LPA_1DBT_UPC_A = 20] = "LPA_1DBT_UPC_A", e[e.LPA_1DBT_UPC_E = 21] = "LPA_1DBT_UPC_E", e[e
					.LPA_1DBT_EAN13 = 22] = "LPA_1DBT_EAN13", e[e.LPA_1DBT_EAN8 = 23] = "LPA_1DBT_EAN8", e[e
					.LPA_1DBT_CODE39 = 24] = "LPA_1DBT_CODE39", e[e.LPA_1DBT_ITF25 = 25] = "LPA_1DBT_ITF25", e[e
					.LPA_1DBT_CODABAR = 26] = "LPA_1DBT_CODABAR", e[e.LPA_1DBT_CODE93 = 27] = "LPA_1DBT_CODE93",
				e[e.LPA_1DBT_CODE128 = 28] = "LPA_1DBT_CODE128", e[e.LPA_1DBT_ISBN = 29] = "LPA_1DBT_ISBN", e[e
					.LPA_1DBT_ECODE39 = 30] = "LPA_1DBT_ECODE39", e[e.LPA_1DBT_AUTO = 60] = "LPA_1DBT_AUTO"
		}(l || (l = {})), e.LPA_JobNames = void 0, (c = e.LPA_JobNames || (e.LPA_JobNames = {})).Preview =
		"#!#Preview#!#", c.Transparent = "#!#Transparent#!#", c.Print = "dtpweb", e.LPA_PrintActions = void 0, (
			h = e.LPA_PrintActions || (e.LPA_PrintActions = {}))[h.PrintData = 1] = "PrintData", h[h
			.PrevBase64 = 2] = "PrevBase64", h[h.PrevUrl = 4] = "PrevUrl", h[h.TransBase64 = 130] =
		"TransBase64", h[h.Print = 4096] = "Print",
		function(e) {
			e[e.Print = 0] = "Print", e[e.White = 1] = "White", e[e.Transparent = 2] = "Transparent"
		}(g || (g = {})), e.LPA_Result = void 0, (p = e.LPA_Result || (e.LPA_Result = {}))[p.WAIT_FOR_ASYNC = -
			1] = "WAIT_FOR_ASYNC", p[p.OK = 0] = "OK", p[p.PARAM_ERROR = 1] = "PARAM_ERROR", p[p.SYSTEM_ERROR =
			2] = "SYSTEM_ERROR", p[p.NO_SUPPORTED_PRINTER = 3] = "NO_SUPPORTED_PRINTER", p[p
			.UNSUPPORTED_PRINTER = 4] = "UNSUPPORTED_PRINTER", p[p.NO_PRINT_DATA = 5] = "NO_PRINT_DATA", p[p
			.NO_PAGE_DIMENSION = 6] = "NO_PAGE_DIMENSION", p[p.INVALID_FILE = 7] = "INVALID_FILE", p[p
			.ERROR_START_JOB = 8] = "ERROR_START_JOB", p[p.UNSUPPORTED_FUNCTION = 9] = "UNSUPPORTED_FUNCTION",
		p[p.INVALID_FONT_NAME = 10] = "INVALID_FONT_NAME", p[p.NETWORK_FAILED = 90] = "NETWORK_FAILED", p[p
			.NETWORK_TIMEOUT = 91] = "NETWORK_TIMEOUT", p[p.NETWORK_ERROR = 92] = "NETWORK_ERROR", p[p
			.NETWORK_ABORT = 93] = "NETWORK_ABORT", p[p.NETWORK_UNSUPPORTED = 94] = "NETWORK_UNSUPPORTED", p[p
			.NETWORK_EXCEPTION = 95] = "NETWORK_EXCEPTION",
		function(e) {
			e[e.ShowReadNone = 0] = "ShowReadNone", e[e.ShowReadDown = 1] = "ShowReadDown", e[e.ShowReadUp =
				2] = "ShowReadUp", e[e.ShowStartStop = 4] = "ShowStartStop", e[e.EanCheckCode = 8] =
				"EanCheckCode"
		}(d || (d = {})),
		function(e) {
			e[e.Unicode = 0] = "Unicode", e[e.Ansi = 1] = "Ansi", e[e.UTF8 = 2] = "UTF8"
		}(f || (f = {})),
		function(e) {
			e[e.ModeNum = 0] = "ModeNum", e[e.ModeAn = 1] = "ModeAn", e[e.Mode8Bit = 2] = "Mode8Bit", e[e
					.ModeKanji = 3] = "ModeKanji", e[e.ModeStructure = 4] = "ModeStructure", e[e.ModeEci = 5] =
				"ModeEci", e[e.ModeFnc1First = 6] = "ModeFnc1First", e[e.ModeFnc1Second = 7] = "ModeFnc1Second"
		}(m || (m = {})),
		function(e) {
			e[e.EccLevel_L = 0] = "EccLevel_L", e[e.EccLevel_M = 1] = "EccLevel_M", e[e.EccLevel_Q = 2] =
				"EccLevel_Q", e[e.EccLevel_H = 3] = "EccLevel_H"
		}(y || (y = {})),
		function(e) {
			e[e.Unicode = 0] = "Unicode", e[e.Ansi = 1] = "Ansi", e[e.UTF8 = 2] = "UTF8"
		}(_ || (_ = {})),
		function(e) {
			e[e.ModeAuto = 0] = "ModeAuto", e[e.ModeNumeric = 1] = "ModeNumeric", e[e.ModeText = 2] =
				"ModeText", e[e.ModeBinary = 3] = "ModeBinary"
		}(P || (P = {})),
		function(e) {
			e[e.EccLevel_Auto = 0] = "EccLevel_Auto", e[e.EccLevel_1 = 1] = "EccLevel_1", e[e.EccLevel_2 = 2] =
				"EccLevel_2", e[e.EccLevel_3 = 3] = "EccLevel_3", e[e.EccLevel_4 = 4] = "EccLevel_4", e[e
					.EccLevel_5 = 5] = "EccLevel_5", e[e.EccLevel_6 = 6] = "EccLevel_6", e[e.EccLevel_7 = 7] =
				"EccLevel_7", e[e.EccLevel_8 = 8] = "EccLevel_8"
		}(A || (A = {})),
		function(e) {
			e[e.LPASIF_RAWDATA = 0] = "LPASIF_RAWDATA", e[e.LPASIF_BPP_1 = 1] = "LPASIF_BPP_1", e[e
				.LPASIF_BPP_1N = 2] = "LPASIF_BPP_1N", e[e.LPASIF_32_RGBA = 32] = "LPASIF_32_RGBA", e[e
				.LPASIF_32_BGRA = 33] = "LPASIF_32_BGRA", e[e.LPASIF_32_RGB = 34] = "LPASIF_32_RGB", e[e
				.LPASIF_32_BGR = 35] = "LPASIF_32_BGR", e[e.LPASIF_PACKAGE = 90] = "LPASIF_PACKAGE", e[e
				.LPASIF_IMAGEDATA = 93] = "LPASIF_IMAGEDATA"
		}(v || (v = {})),
		function(e) {
			e[e.UrlEncoded = 0] = "UrlEncoded", e[e.Json = 1] = "Json", e[e.Blob = 2] = "Blob", e[e.Base64 =
				3] = "Base64", e[e.Hex16 = 4] = "Hex16", e[e.Lz77 = 5] = "Lz77", e[e.Binary = 6] = "Binary"
		}(T || (T = {})), e.LPA_DrawType = void 0, (b = e.LPA_DrawType || (e.LPA_DrawType = {})).Text = "text",
		b.Barcode = "barcode", b.QRCode = "qrcode", b.Pdf417 = "pdf417", b.DataMatrix = "dataMatrix", b.Image =
		"image", b.Table = "table", b.Rect = "rectangle", b.RoundRect = "roundRectangle", b.Ellipse = "ellipse",
		b.Line = "line", b.DashLine = "dashLine",
		function(e) {
			e.Page = "Page", e.Text = "Text", e.String = "String", e.Barcode = "Barcode", e.Qrcode = "Qrcode", e
				.Date = "Date", e.Time = "Time", e.Image = "Image", e.Photo = "Photo", e.Logo = "Logo", e
				.Rectangle = "Rectangle", e.Rect = "Rect", e.Ellipse = "Ellipse", e.Circle = "Circle", e.Line =
				"Line", e.Table = "Table", e.ArcText = "ArcText"
		}(L || (L = {}));
	var Ie = {
			scaleUnit: 0,
			getJobAction: function(e, t) {
				var n = e || "";
				return "number" == typeof t ? t : n.startsWith("#!#Prev") ? 2 : n.startsWith("#!#Trans") ?
					130 : 4096
			},
			assignValue: function(e, t) {
				var n = e || {};
				for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (this.isPlainObject(n[r]) &&
					this.isPlainObject(t[r]) ? this.assignValue(n[r], t[r]) : this.isPlainObject(t[r]) ?
					n[r] = this.assignValue({}, t[r]) : Array.isArray(t[r]) ? n[r] = t[r].slice() : n[
					r] = t[r]);
				return n
			},
			merge: function(e) {
				for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
				var r = e || {};
				if (!t) return r;
				for (var i = 0; i < t.length; i++) r = this.assignValue(r, t[i]);
				return r
			},
			isObject: function(e) {
				return null !== e && "object" == typeof e
			},
			isPlainObject: function(e) {
				if ("[object Object]" !== toString.call(e)) return !1;
				var t = Object.getPrototypeOf(e);
				return null === t || t === Object.prototype
			},
			isArrayBuffer: function(e) {
				return "[object ArrayBuffer]" === toString.call(e)
			},
			isArray: function(e) {
				return Array.isArray ? Array.isArray(e) : "[object Array]" === Object.prototype.toString
					.call(e)
			},
			isHttpsRequest: function(e) {
				return /https:?/.test(e)
			},
			isNumberString: function(e) {
				return !!e && (!!(e = e.trim()).match(/^[-+]?[0-9]*\.?[0-9]+$/) || !!e.match(
					/^(0x)?[0-9a-f]+$/i))
			},
			isBooleanString: function(e) {
				return !!e && !!(e = e.trim()).match(/^(yes)|(no)|(true)|(false)$/i)
			},
			getNumber: function(e, t) {
				return e = (e || "").trim(), this.isNumberString(e) ? Number(e) : t || 0
			},
			getBoolean: function(e, t) {
				return !!(e = (e || "").trim()).match(/^(yes)|(true)$/i) || !e.match(/^(no)|(false)$/i) && (
					t || !1)
			},
			parseArray: function(e, t) {
				void 0 === t && (t = 1);
				var n = [];
				if (Ie.isArray(e)) return e;
				if ("string" == typeof e) return e.split(",");
				if ("number" == typeof e)
					for (var r = 0; r < t; r++) n.push(e);
				return n
			},
			parseMargin: function(e) {
				var t, n, r, i, a = [];
				if (e.margin && (1 === (a = Ie.parseArray(e.margin, 4)).length ? a = [a[0], a[0], a[0], a[
						0]] : 2 === a.length ? a = [a[0], a[1], a[0], a[1]] : 3 === a.length && a.push(
						a[1])), e.marginH) {
					var o = Ie.parseArray(e.marginH, 2);
					a[1] = null !== (t = o[0]) && void 0 !== t ? t : 0, a[3] = null !== (n = o[1]) &&
						void 0 !== n ? n : o[0]
				}
				if (e.marginV) {
					o = Ie.parseArray(e.marginV, 2);
					a[0] = null !== (r = o[0]) && void 0 !== r ? r : 0, a[2] = null !== (i = o[1]) &&
						void 0 !== i ? i : o[0]
				}
				return a
			},
			getParamString: function(e) {
				e = e || {};
				var t = [];
				for (var n in e) {
					var r = e[n];
					null != r && ("object" != typeof r && "function" != typeof r && t.push("".concat(n, "=")
						.concat(encodeURIComponent(r))))
				}
				return t.length > 0 ? t.join("&") : ""
			},
			getRequestData: function(e, t) {
				if (null == t ? t = [] : "object" != typeof t && (t = [t]), t.length && "object" ==
					typeof t[0]) return t[0];
				var n = {};
				if ("string" == typeof e && (e = [e]), e.length < 1 || !e[0]) return n;
				for (var r = 0; r < e.length; r++) n[e[r]] = t[r];
				return n
			},
			toHexByteString: function(e, t) {
				return (t || "") + "00".concat(e.toString(16)).slice(-2)
			},
			loadImage: function(e, t) {
				try {
					if (e) {
						var n = new Image;
						n.crossOrigin = "anonymous", n.src = e, n.onload = function() {
							t && t(n)
						}, n.onerror = function(e) {
							console.warn(e), t && t(null)
						}
					} else console.warn("DzImage.CreateImage: src不能为空!"), t && t(null)
				} catch (e) {
					console.warn(e, "#### 【loadImage.catch】 图片加载异常，error:"), t && t(null)
				}
			},
			image2DataUrl: function(e) {
				if (e) {
					var t = document.createElement("canvas");
					t.width = e.width, t.height = e.height;
					var n = t.getContext("2d");
					if (n) return n.drawImage(e, 0, 0, e.width, e.height), t.toDataURL()
				}
			},
			filterRecord: function(e, t) {
				return Object.keys(e).filter((function(n) {
					return t(n, e[n])
				})).reduce((function(t, n) {
					return t[n] = e[n], t
				}), {})
			},
			processResult: function(e, t, n) {
				t && t(e), n && n(e)
			},
			buildURL: function(e, t) {
				var n = "string" == typeof t ? t : this.getParamString(t);
				return n ? "".concat(e, ":").concat(n) : e
			},
			request: function(t, n) {
				"undefined" != typeof XMLHttpRequest ? this.requestXMLHttp(t, n) : "undefined" !=
					typeof process && "[object process]" === Object.prototype.toString.call(process) ? this
					.requestNodeHttp(t, n) : n({
						statusCode: e.LPA_Result.NETWORK_UNSUPPORTED,
						resultInfo: "not supported http request environment!"
					})
			},
			requestXMLHttp: function(t, n) {
				var r, i = new XMLHttpRequest,
					a = t.host || R.IP,
					o = t.port || R.PORT1,
					s = t.baseUrl || "http://".concat(a, ":").concat(o),
					u = t.data,
					l = t.headers;
				t.url && "/" === t.url[0] && (t.url = t.url.substring(1));
				var c = "".concat(s, "/").concat(t.url);
				try {
					i.open(t.method || R.METHOD_GET, c, !t.sync), t.timeout && !t.sync && (i.timeout = t
						.timeout);
					var h = function() {
						i && (r = 200 === i.status ? JSON.parse(i.responseText) : {
							statusCode: e.LPA_Result.NETWORK_FAILED,
							resultInfo: i.responseText
						}, n(r), i = null)
					};
					if ("onloadend" in i ? i.onloadend = h : i.onreadystatechange = function() {
							i && 4 === i.readyState && (0 !== i.status || i.responseURL && 0 === i
								.responseURL.indexOf("file:")) && setTimeout(h)
						}, i.onabort = function() {
							i && (n({
								statusCode: e.LPA_Result.NETWORK_ABORT,
								resultInfo: "Request aborted!"
							}), i = null)
						}, i.onerror = function() {
							n({
								statusCode: e.LPA_Result.NETWORK_ERROR,
								resultInfo: "Network Error"
							}), i = null
						}, i.ontimeout = function() {
							n({
								statusCode: e.LPA_Result.NETWORK_TIMEOUT,
								resultInfo: t.timeout ? "timeout of ".concat(t.timeout,
									"ms exceeded") : "timeout exceeded"
							}), i = null
						}, l && "setRequestHeader" in i)
						for (var g in l) void 0 === u && "content-type" === g.toLowerCase() ? delete l[g] :
							i.setRequestHeader(g, l[g]);
					i.send(u)
				} catch (t) {
					n({
						statusCode: e.LPA_Result.NETWORK_EXCEPTION,
						resultInfo: t
					})
				}
			},
			requestNodeHttp: function(t, n) {
				var r = require("http");
				t.url && "/" !== t.url[0] && (t.url = "/".concat(t.url));
				var i = {
						host: t.host || R.IP,
						port: t.port || R.PORT1,
						method: t.method || R.METHOD_GET,
						path: t.url,
						headers: t.headers
					},
					a = "",
					o = r.request(i, (function(t) {
						t.on("data", (function(e) {
							a += e
						})), t.on("end", (function() {
							var t = {
								statusCode: e.LPA_Result.NETWORK_EXCEPTION,
								resultInfo: a
							};
							try {
								t = JSON.parse(a)
							} catch (e) {
								console.log(e)
							}
							n(t)
						})), t.on("error", (function(t) {
							r.aborted || n({
								statusCode: e.LPA_Result.NETWORK_ERROR,
								resultInfo: t
							})
						}))
					}));
				if (o.on("error", (function(t) {
						n({
							statusCode: e.LPA_Result.NETWORK_FAILED,
							resultInfo: t
						})
					})), o.on("socket", (function(e) {
						e.setKeepAlive(!0, 6e4)
					})), t.timeout) {
					var s = t.timeout;
					o.setTimeout(s, (function() {
						o.destroy(), n({
							statusCode: e.LPA_Result.NETWORK_TIMEOUT,
							resultInfo: t.timeout ? "timeout of ".concat(t.timeout,
								"ms exceeded") : "timeout exceeded"
						})
					}))
				}
				o.end(t.data)
			},
			unitConvert: function(e) {
				return 1 === this.scaleUnit && e ? 100 * e : e
			},
			poundToMm: function(e) {
				return 25.4 * e / 72
			},
			mmToPound: function(e) {
				return 72 * e / 25.4
			},
			unitConvertOfDrawBase: function(e, t) {
				e = e || {};
				var n = t || [],
					r = n[3] || 0,
					i = n[0] || 0,
					a = n[4] || 0,
					o = n[5] || 0,
					s = e.x || 0,
					u = e.y || 0;
				return e.x = this.unitConvert(s + r + a), e.y = this.unitConvert(u + i + o), e.width = this
					.unitConvert(e.width), e.height = this.unitConvert(e.height), e.orientation && e
					.orientation > 3 && (e.orientation = e.orientation / 90), e
			},
			unitConvertOfDrawRect: function(e, t) {
				return (e = this.unitConvertOfDrawBase(e, t)).width = e.width || this.unitConvert(R
						.RECT_WIDTH), e.height = e.height || e.width, e.cornerWidth = this.unitConvert(e
						.cornerWidth), e.cornerHeight = this.unitConvert(e.cornerHeight) || e.cornerWidth, e
					.lineWidth = this.unitConvert(e.lineWidth || R.LINE_WIDTH), e
			},
			unitConvertOfLine: function(e, t) {
				var n, r;
				e = e || {};
				var i = t || [],
					a = i[3] || 0,
					o = i[0] || 0,
					s = i[4] || 0,
					u = i[5] || 0,
					l = e.x1 || 0,
					c = e.y1 || 0,
					h = null !== (n = e.x2) && void 0 !== n ? n : l,
					g = null !== (r = e.y2) && void 0 !== r ? r : c;
				if (e.x1 = this.unitConvert(l + a + s), e.y1 = this.unitConvert(c + o + u), e.x2 = this
					.unitConvert(h + a + s), e.y2 = this.unitConvert(g + o + u), e.lineWidth = this
					.unitConvert(e.lineWidth || R.LINE_WIDTH), !e.dashLens && Ie.isArray(e.dashLen) ? (e
						.dashLens = e.dashLen, e.dashLen = void 0) : e.dashLen || "string" != typeof e
					.dashLens || (e.dashLen = e.dashLens, e.dashLens = void 0), "string" == typeof e
					.dashLen && (e.dashLens = e.dashLen.split(",")), e.dashLens && e.dashLens.length > 0) {
					1 === e.dashLens.length && e.dashLens.push(e.dashLens[0]);
					for (var p = 0; p < e.dashLens.length; p++) e.dashLens[p] = this.unitConvert(e.dashLens[
						p]);
					e.dashLen = e.dashLens.join(","), delete e.dashLens
				}
				return e.orientation && e.orientation > 3 && (e.orientation = e.orientation / 90), e
			},
			checkTextOptions: function(e) {
				if (e.fontHeight = Ie.unitConvert(e.fontHeight), e.charSpace = Ie.unitConvert(e.charSpace),
					"number" == typeof e.lineSpace && (e.lineSpace = Ie.unitConvert(e.lineSpace)), e
					.leadingIndent || (e.leadingIndentChars ? (e.leadingIndent = 10 * e.leadingIndentChars,
							delete e.leadingIndentChars) : e.leadingIndentMM ? (e.leadingIndentMM >= .01 ? e
							.leadingIndent = 100 * e.leadingIndentMM + 1e3 : e.leadingIndentMM <= -.01 && (e
								.leadingIndent = 100 * e.leadingIndentMM - 1e3), delete e.leadingIndentMM) :
						e.leadingIndentColon && (e.leadingIndent = 1e3, delete e.leadingIndentColon)), 0 ===
					e.leadingIndent && delete e.leadingIndent, Array.isArray(e.regionCorners)) {
					for (var t = 0; t < e.regionCorners.length; t++) e.regionCorners[t] = Ie.unitConvert(e
						.regionCorners[t]);
					e.regionCorners = e.regionCorners.join(",")
				}
				if (!e.regionCorners) {
					var n = [];
					if (e.regionLeftUpCorner && (n[0] = e.regionLeftUpCorner, delete e.regionLeftUpCorner),
						e.regionRightUpCorner && (n[1] = e.regionRightUpCorner, delete e
							.regionRightUpCorner), e.regionRightBottomCorner && (n[2] = e
							.regionRightBottomCorner, delete e.regionRightBottomCorner), e
						.regionLeftBottomCorner && (n[3] = e.regionLeftBottomCorner, delete e
							.regionLeftBottomCorner), n.length > 0) {
						var r = [];
						for (t = 0; t < 4; t++) {
							var i = n[t];
							if ("string" == typeof i && (i = i.split(",")), r[t] = "0,0", Array.isArray(
								i)) {
								i.length > 2 && (i = i.slice(0, 2));
								for (var a = 0; a < 2; a++) i[a] = Ie.unitConvert(i[a] || 0);
								r[t] = i.join(",")
							}
						}
						e.regionCorners = r.join(",")
					}
				}
				if (e.regionLeftBorders) {
					var o = e.regionLeftBorders;
					if ("string" == typeof e.regionLeftBorders && (o = e.regionLeftBorders.split(",")),
						Array.isArray(o) && o.length > 2) {
						for (t = 0; t < o.length; t++) o[t] = Ie.unitConvert(o[t]);
						e.regionLeftBorders = o.join(",")
					} else delete e.regionLeftBorders
				}
				if (e.regionRightBorders)
					if ("string" == typeof(o = e.regionRightBorders) && (o = o.split(",")), Array.isArray(
						o) && o.length > 2) {
						for (t = 0; t < o.length; t++) o[t] = Ie.unitConvert(o[t]);
						e.regionRightBorders = o.join(",")
					} else delete e.regionRightBorders;
				return void 0 !== e.text && null !== e.text || (Array.isArray(e.texts) ? e.text = e.texts
					.join("\n") : void 0 !== e.texts && null !== e.texts && (e.text = e.texts)), e
			},
			getAgent: function() {
				return navigator.userAgent.toLowerCase() || ""
			},
			isWin32: function() {
				var e = this.getAgent();
				return e.indexOf("win32") || e.indexOf("wow32")
			},
			isWin64: function() {
				var e = this.getAgent();
				return e.indexOf("win64") || e.indexOf("wow64")
			},
			isWindows: function() {
				var e = this.getAgent();
				return e.indexOf("win") >= 0 || e.indexOf("wow") >= 0
			},
			isMac: function() {
				return /macintosh|mac os x/i.test(this.getAgent())
			},
			formatDate: function(e, t) {
				var n, r = e || "HH:mm:ss.SSS",
					i = {
						"y+": (t = t || new Date).getFullYear(),
						"M+": t.getMonth() + 1,
						"d+": t.getDate(),
						"h+": t.getHours(),
						"H+": t.getHours(),
						"m+": t.getMinutes(),
						"s+": t.getSeconds(),
						"q+": Math.floor((t.getMonth() + 3) / 3),
						"S+": t.getMilliseconds()
					};
				for (var a in i)
					if (n = new RegExp("(".concat(a, ")")).exec(r)) {
						var o = "".concat(i[a]),
							s = "00".concat(o),
							u = n[1].length > s.length ? 0 : s.length - n[1].length;
						r = r.replace(n[1], 1 === n[1].length ? o : s.substring(u))
					} return r
			},
			downloadDtpweb: function(e) {
				var t = document.createElement("a");
				return t.href = e, t.click(), !0
			},
			parseXmlDocument: function(e) {
				try {
					return e ? (new DOMParser).parseFromString(e, "text/xml") : void 0
				} catch (e) {
					console.warn("xml parse error:"), console.warn(e)
				}
			},
			getElementsByTagName: function(e, t, n) {
				if (!e || !t || e.childElementCount <= 0) return [];
				if (n) {
					for (var r = [], i = 0; i < e.childElementCount; i++) {
						var a = e.children[i];
						a.tagName.toLowerCase() === t.toLocaleLowerCase() && r.push(a)
					}
					return r
				}
				return e.getElementsByTagName(t)
			},
			getElementByTagName: function(e, t, n) {
				return this.getElementsByTagName(e, t, n)[0]
			},
			getElementValue: function(e) {
				try {
					return e.childNodes[0].nodeValue || ""
				} catch (e) {
					return ""
				}
			},
			getElementValueByTagName: function(e, t) {
				if (!t) return "";
				for (var n = t.split(";"), r = 0; r < n.length; r++) {
					var i = n[r];
					if (i) {
						var a = this.getElementsByTagName(e, i);
						return a.length > 0 ? this.getElementValue(a[0]) : ""
					}
				}
			},
			parseWdfxString: function(e) {
				var t = this.parseXmlDocument(e),
					n = t ? t.getElementsByTagName("LPAPI") : void 0;
				return n && n.length > 0 ? n[0] : void 0
			},
			isInnerRect: function(e, t) {
				return e.x >= t.x && e.x + e.width <= t.x + t.width && e.y >= t.y && e.y + e.height <= t.y +
					t.height
			},
			hasIntersection: function(e, t) {
				return e.x < t.x + t.width && t.x < e.x + e.width && e.y < t.y + t.height && t.y < e.y + e
					.height
			},
			getUnionRect: function(e, t) {
				var n = Math.min(e.x, t.x),
					r = Math.min(e.y, t.y);
				return {
					x: n,
					y: r,
					width: Math.max(e.x + e.width, t.x + t.width) - n,
					height: Math.max(e.y + e.height, t.y + t.height) - r
				}
			},
			getUnionRectOfRelateRect: function(e, t, n) {
				for (var r = 0, i = t; r < i.length; r++) {
					var a = i[r];
					a !== e ? Ie.hasIntersection(e, a) && (n && n.push(a), e = Ie.getUnionRect(e, a)) : n &&
						n.push(a)
				}
				return e
			},
			shrinkCellContent: function(e, t) {
				return {
					x: e.x + t,
					y: e.y + t,
					width: e.width - 2 * t,
					height: e.height - 2 * t
				}
			}
		},
		Ne = function() {
			function n() {}
			return n.parseEmbeddedImg = function(e) {
				if (!e) return e;
				var t = "*****",
					n = e.indexOf(t);
				if (n < 0) return e;
				var r = e.substring(0, n).trim();
				return e = e.substring(n + 5), r && r.toLowerCase().startsWith("svg") ? (console.warn(
					"---- 底层打印助手不支持 SVG 图片的绘制！"), "") : "data:image/".concat(r, ";base64,").concat(e)
			}, n.parseBaseElement = function(e, t) {
				var n = t || {},
					r = Ie.getElementValueByTagName(e, "x"),
					i = Ie.getElementValueByTagName(e, "y"),
					a = Ie.getElementValueByTagName(e, "width"),
					o = Ie.getElementValueByTagName(e, "height"),
					s = Ie.getElementValueByTagName(e, "orientation;direction");
				return Ie.isNumberString(r) && (n.x = Number(r)), Ie.isNumberString(i) && (n.y = Number(i)),
					Ie.isNumberString(a) && (n.width = Number(a)), Ie.isNumberString(o) && (n.height =
						Number(o)), n.orientation = Ie.getNumber(s), n
			}, n.parseBorderElement = function(e, t) {
				var n = this.parseBaseElement(e, t),
					r = Ie.getElementValueByTagName(e, "filled"),
					i = Ie.getElementValueByTagName(e, "lineWidth");
				return Ie.isBooleanString(r) && (n.fill = Ie.getBoolean(r)), n.fill || (n.lineWidth = Ie
					.getNumber(i, .5)), n
			}, n.parseContentElement = function(e, t) {
				var n = this.parseBaseElement(e, t),
					r = Ie.getElementValueByTagName(e, "content"),
					i = Ie.getElementValueByTagName(e, "contentType"),
					a = Ie.getElementValueByTagName(e, "verAlignment"),
					o = Ie.getElementValueByTagName(e, "horAlignment"),
					s = Ie.getElementValueByTagName(e, "dataColumnName;dataName");
				return n.contentType = Ie.getNumber(i), 2 === n.contentType ? n.text = s ? "[".concat(s,
					"]") : r || n.text || "" : r && (n.text = r), n.horizontalAlignment = Ie.getNumber(
					o), n.verticalAlignment = Ie.getNumber(a), n
			}, n.parseFontTextElement = function(e, t) {
				var n = this.parseContentElement(e, t),
					r = Ie.getElementValueByTagName(e, "fontName"),
					i = Ie.getElementValueByTagName(e, "fontHeight"),
					a = Ie.getElementValueByTagName(e, "fontStyle");
				return r && (n.fontName = r), Ie.isNumberString(i) && (n.fontHeight = Number(i)), Ie
					.isNumberString(a) && (n.fontStyle = Number(a)), n
			}, n.parseTextElement = function(e, n, r) {
				var i = this.parseFontTextElement(e);
				i.text || 0 !== i.contentType || void 0 === r || (i.text = r);
				var a = Ie.getElementValueByTagName(e, "charSpace"),
					o = Ie.getElementValueByTagName(e, "lineSpace"),
					s = Ie.getElementValueByTagName(e, "autoReturn"),
					u = t(t({}, i), {
						type: "text",
						autoReturn: Ie.getNumber(s),
						lineSpace: o,
						charSpace: Ie.getNumber(a)
					});
				return null == n || n.push(u), u
			}, n.parseDateTimeElement = function(e, t) {
				var n = this.parseTextElement(e, t),
					r = Ie.getElementValueByTagName(e, "dateFormat"),
					i = Ie.getElementValueByTagName(e, "dateOffset;dateDiff"),
					a = Ie.getElementValueByTagName(e, "timeFormat"),
					o = Ie.getElementValueByTagName(e, "hourOffset;hourDiff"),
					s = Ie.getElementValueByTagName(e, "minuteOffset;minuteDiff"),
					u = Ie.getElementValueByTagName(e, "secondOffset;secondDiff"),
					l = Ie.getNumber(i),
					c = Ie.getNumber(o),
					h = Ie.getNumber(s),
					g = Ie.getNumber(u),
					p = new Date;
				if (l > 0 || c > 0 || h > 0 || g > 0) {
					var d = p.getTime();
					l > 0 && (d += 864e5 * l), c > 0 && (d += 36e5 * c), h > 0 && (d += 6e4 * h), g > 0 && (
						d += 1e3 * g), p.setTime(d)
				}
				return n.text = r && a ? Ie.formatDate("".concat(r, " ").concat(a)) : r || a ? Ie
					.formatDate(r || a, p) : Ie.formatDate("yyyy年MM月dd日"), n
			}, n.parse1DBarcodeElement = function(e, n) {
				var r = this.parseFontTextElement(e),
					i = Ie.getElementValueByTagName(e, "type;barcodeType"),
					a = Ie.getElementValueByTagName(e, "textAlignment"),
					o = Ie.getElementValueByTagName(e, "flags;barcodeFlags"),
					s = Ie.getElementValueByTagName(e, "horAlignment"),
					u = Ie.getNumber(i);
				void 0 === r.text && (u === l.LPA_1DBT_EAN13 ? r.text = "690123456789" : u === l
					.LPA_1DBT_EAN8 ? r.text = "6901234" : u === l.LPA_1DBT_UPC_A ? r.text =
					"69012345678" : u === l.LPA_1DBT_UPC_E ? r.text = "0123456" : u === l
					.LPA_1DBT_ISBN ? r.text = "978012345678" : r.text = "12345678");
				var c = Ie.getNumber(o, 2),
					h = t(t({}, r), {
						type: "barcode",
						barcodeType: u >= 20 && u <= 30 ? u : l.LPA_1DBT_AUTO,
						textAlignment: Ie.getNumber(a),
						textHeight: 0 === c ? 0 : r.fontHeight,
						barcodeFlags: 1 === c ? 2 : 2 === c ? 1 : c,
						horizontalAlignment: Ie.getNumber(s, 1)
					});
				return null == n || n.push(h), h
			}, n.parse2DBarcodeElement = function(e, n) {
				var r = this.parseContentElement(e, {
						text: "http://detonger.com/wdbq"
					}),
					i = Ie.getElementValueByTagName(e, "eccLevel"),
					a = Ie.getElementValueByTagName(e, "type;barcodeType"),
					o = Ie.getElementValueByTagName(e, "pdf417EccLevel"),
					s = Ie.getElementValueByTagName(e, "pdf417Cols"),
					u = Ie.getElementValueByTagName(e, "dmCodeShape"),
					l = Ie.getNumber(a);
				if (1 === l) {
					var c = t(t({}, r), {
						type: "pdf417",
						eccLevel: Ie.getNumber(o),
						codeColumns: Ie.getNumber(s)
					});
					return null == n || n.push(c), c
				}
				if (2 === l) {
					c = t(t({}, r), {
						type: "dataMatrix",
						symbolShape: Ie.getNumber(u)
					});
					return null == n || n.push(c), c
				}
				c = t(t({}, r), {
					type: "qrcode",
					eccLevel: Ie.getNumber(i)
				});
				return null == n || n.push(c), c
			}, n.parseImageElement = function(e, n) {
				var r = this.parseContentElement(e),
					i = Ie.getElementValueByTagName(e, "threshold"),
					a = this.parseEmbeddedImg(r.text || "");
				if (a) {
					r.text = "";
					var o = t(t({}, r), {
						type: "image",
						imageFile: a,
						threshold: Ie.getNumber(i, 192)
					});
					return null == n || n.push(o), o
				}
			}, n.parseRectangleElement = function(e, n) {
				var r = this.parseBorderElement(e);
				if (r.width && r.height) {
					var i = Ie.getElementValueByTagName(e, "type;rectangleType"),
						a = Ie.getElementValueByTagName(e, "cornerWidth"),
						o = Ie.getNumber(i),
						s = t({}, r);
					return 1 === o ? (s.type = "roundRectangle", s.cornerWidth = Ie.isNumberString(a) ?
							Number(a) : 1) : 2 === o ? s.type = "ellipse" : 3 === o ? (r.width > r.height ?
							(r.x = (r.x || 0) + .5 * (r.width - r.height), r.width = r.height) : (r.y = (r
								.y || 0) + .5 * (r.height - r.width), r.height = r.width), s = t(t({}, r), {
								type: "ellipse"
							})) : (s.type = "rectangle", s.cornerWidth = s.cornerHeight = 0), null == n || n
						.push(s), s
				}
			}, n.parseLineElement = function(e, n) {
				var r = this.parseBaseElement(e),
					i = Ie.getElementValueByTagName(e, "x1"),
					a = Ie.getElementValueByTagName(e, "x2"),
					o = Ie.getElementValueByTagName(e, "y1"),
					s = Ie.getElementValueByTagName(e, "y2"),
					u = Ie.getElementValueByTagName(e, "type;lineType"),
					l = Ie.getElementValueByTagName(e, "dashGap"),
					c = r.x || 0,
					h = r.y || 0,
					g = r.width || 0,
					p = r.height || 0;
				(i || a) && (o || s) && (c = Ie.getNumber(i), g = Ie.getNumber(a) - c, h = Ie.getNumber(o),
					p = Ie.getNumber(s) - h);
				var d, f = {
					lineWidth: Math.min(g, p)
				};
				if (g > p ? (f.x1 = c, f.x2 = c + g, f.y1 = f.y2 = h + .5 * p) : (f.y1 = h, f.y2 = h + p, f
						.x1 = f.x2 = c + .5 * g), 1 === Ie.getNumber(u)) {
					var m = Ie.getNumber(l, 1);
					f.dashLens = [m, m], d = t(t({}, f), {
						type: "dashLine"
					})
				} else d = t(t({}, f), {
					type: "line"
				});
				return null == n || n.push(d), d
			}, n.parseTableElement = function(t, n) {
				var r = this.parseBorderElement(t);
				if (!(!r.width || !r.height || r.width <= 0 || r.height <= 0)) {
					var i = Ie.getElementValueByTagName(t, "rows;row;rowCount"),
						a = Ie.getElementValueByTagName(t, "cols;col;colCount"),
						o = Ie.getElementValueByTagName(t, "rowHeight") || "",
						s = Ie.getElementValueByTagName(t, "colWidth") || "",
						u = Ie.getElementValueByTagName(t, "group") || "",
						l = Ie.getNumber(i),
						c = Ie.getNumber(a),
						h = o.split(",").map((function(e) {
							return Ie.getNumber(e)
						})),
						g = s.split(",").map((function(e) {
							return Ie.getNumber(e)
						})),
						p = u.split(";").map((function(e) {
							var t = e.split(",").map((function(e) {
								return Ie.getNumber(e)
							}));
							return {
								x: t.length > 1 ? t[1] - 1 : 0,
								y: t.length > 0 ? t[0] - 1 : 0,
								width: t.length > 3 ? t[3] - t[1] + 1 : 0,
								height: t.length > 2 ? t[2] - t[0] + 1 : 0
							}
						})),
						d = [],
						f = {
							type: e.LPA_DrawType.Table,
							x: r.x,
							y: r.y,
							width: r.width,
							height: r.height,
							rowCount: l,
							columnCount: c,
							rowHeights: h,
							columnWidths: g,
							groups: p,
							cells: d
						},
						m = Ie.getElementByTagName(t, "Cells");
					if (m && m.children.length > 0)
						for (var y = 0; y < l; y++)
							for (var _ = 0; _ < c; _++) {
								var P = m.children[y * c + _];
								if (P.tagName === L.Text) {
									var A = this.parseTextElement(P);
									d.push(A)
								} else P.tagName === L.Qrcode ? d.push(this.parse2DBarcodeElement(P)) : P
									.tagName === L.Barcode ? d.push(this.parse1DBarcodeElement(P)) : P
									.tagName === L.Image || P.tagName === L.Logo || P.tagName === L.Photo ?
									d.push(this.parseImageElement(P)) : d.push(void 0)
							}
					return null == n || n.push(f), f
				}
			}, n.parseLPAPIElement = function(e) {
				var t = Ie.getElementValueByTagName(e, "labelWidth;width"),
					n = Ie.getElementValueByTagName(e, "labelHeight;height"),
					r = Ie.getElementValueByTagName(e, "printOrientation;orientation;direction"),
					i = Ie.getElementValueByTagName(e, "printHorOffset;horizontalOffset"),
					a = Ie.getElementValueByTagName(e, "printVerOffset;verticalOffset"),
					o = Ie.getElementValueByTagName(e, "gapType"),
					s = Ie.getElementValueByTagName(e, "gapLength"),
					u = Ie.getElementValueByTagName(e, "printDarkness;printStrength"),
					l = Ie.getElementValueByTagName(e, "printSpeed"),
					c = Ie.getElementValueByTagName(e, "background"),
					h = Ie.getElementValueByTagName(e, "horFlip");
				return {
					jobWidth: Ie.getNumber(t),
					jobHeight: Ie.getNumber(n),
					orientation: Ie.getNumber(r),
					horizontalOffset: Ie.getNumber(i),
					verticalOffset: Ie.getNumber(a),
					horizontalFlip: Ie.getNumber(h),
					printDarkness: Ie.getNumber(u, 255),
					printSpeed: Ie.getNumber(l, 255),
					gapType: Ie.getNumber(o, 255),
					gapLength: Ie.getNumber(s, 0),
					background: c ? this.parseEmbeddedImg(c) : void 0
				}
			}, n
		}(),
		we = void 0,
		Ee = function() {
			function n() {
				this._labelWidth = 0, this._labelHeight = 0, this._margins = [], this._localIPs = new Set, this
					._version = ""
			}
			return n.checkServer = function(t) {
					var n, r = "function" == typeof t ? {
							callback: t
						} : t || {},
						i = this.getInstance(r);
					return i.checkPlugin({
						clientType: r.clientType,
						callback: function(t) {
							n = t.statusCode === e.LPA_Result.OK ? i : void 0, r.callback && r
								.callback(n, t)
						}
					}), n
				}, n.getInstance = function(e) {
					var t = we || (we = new n);
					return t.init(e), t
				}, n.isBase64Str = function(e, t) {
					if (!e) return !1;
					var n = e.lastIndexOf(",");
					if (n <= 0) return !1;
					var r = e.substring(0, n),
						i = /^\s*data:(.+)\/(.+);base64\s*$/i.exec(r);
					return !!i && (t && t(i[1], i[2], e.substring(n)), !0)
				}, n.encodeWithBase64 = function(e, t) {
					var n = btoa(new Uint8Array(e).reduce((function(e, t) {
							return e + String.fromCharCode(t)
						}), "")),
						r = /^\s*data:(.+)\/(.+);base64,?\s*$/i.exec(t || "");
					return r ? "data:".concat(r[1], "/").concat(r[2], ";base64,").concat(n) : n
				}, n.decodeBase64 = function(e) {
					if (e) {
						var t = e.lastIndexOf(","),
							n = t >= 0 ? e.substring(t) : e;
						if (n && n.length % 4 == 0) {
							for (var r = atob(n), i = r.length, a = new Uint8Array(i); i--;) a[i] = r
								.charCodeAt(i);
							return a
						}
					}
				}, n.encodeWithHex16 = function(e, t, n) {
					var r = t || "";
					return Array.from(e).map((function(e) {
						return Ie.toHexByteString(e, n)
					})).join(r)
				}, n.decodeHex16 = function(e) {
					for (var t = [], n = "", r = 0; r < e.length; r += 2) n = e.substring(r, r + 2), t.push(
						parseInt(n, 16));
					return Uint8Array.from(t)
				}, n.readAsDataURL = function(e, t) {
					try {
						if (e instanceof Blob) {
							var r = new FileReader;
							return r.onload = function() {
								t && t(r.result)
							}, r.onerror = function(e) {
								console.warn(e), t && t("")
							}, r.readAsDataURL(e), !0
						}
						if (e instanceof ArrayBuffer) {
							var i = n.encodeWithBase64(e);
							return t(i)
						}
						return t(i = "string" == typeof e ? e : "")
					} catch (e) {
						return console.warn(e), t("")
					}
				}, n.isTransPrevJob = function(e) {
					return !!e && e.toUpperCase().startsWith("#!#trans")
				}, n.isWhitePrevJob = function(e) {
					return !!e && e.toLowerCase().startsWith("#!#prev")
				}, n.isPreviewJob = function(e) {
					return !!e && ((e = e.toLowerCase()).startsWith("#!#trans") || e.startsWith("#!#prev"))
				}, Object.defineProperty(n.prototype, "LastResponse", {
					get: function() {
						return this._Response
					},
					enumerable: !1,
					configurable: !0
				}), Object.defineProperty(n.prototype, "IsJsonMode", {
					get: function() {
						return this._jsonMode || !1
					},
					enumerable: !1,
					configurable: !0
				}), n.prototype.getIpAddress = function(e) {
					return e || this._ip || this._initIp
				}, n.prototype.getPort = function(e) {
					return e || this._port || this._initPort
				}, n.prototype.getTimeout = function(e, t) {
					return e && e > 0 ? e : this._timeout && this._timeout > 0 ? this._timeout : this
						.isLocalPrinter(t) ? R.TIME_OUT : R.OUTER_TIME_OUT
				}, n.prototype.getDeviceType = function(e) {
					return e || this._deviceType
				}, n.prototype.getFontName = function(e) {
					return e || this._fontName || R.FONT_NAME
				}, n.prototype.getFontHeight = function(e) {
					return e || this._fontHeight || R.FONT_HEIGHT
				}, n.prototype.getLineWidth = function(e) {
					return e || this._lineWidth || R.LINE_WIDTH
				}, n.prototype.getRadius = function(e) {
					return e || this._radius || R.RADIUS
				}, n.prototype.getCornerWidth = function(e) {
					return e || this._cornerWidth || R.CORNER_RADIUS
				}, n.prototype.parseMarginAndOffset = function(e) {
					this._margins.splice(0);
					var t = Ie.parseMargin(e);
					t[4] = e.offsetX || 0, t[5] = e.offsetY || 0;
					for (var n = 0; n < 6; n++) this._margins[n] = 1 * (t[n] || 0);
					return this._margins
				}, n.prototype.setFontName = function(e) {
					this._fontName = e
				}, n.prototype.init = function(e) {
					var t = e || {};
					t.ip && (this._initIp = t.ip), t.port && (this._initPort = t.port), t.timeout && (this
							._timeout = t.timeout), this._downloadUrl = t.downloadUrl, t.fontName && (this
							._fontName = t.fontName), t.fontHeight && (this._fontHeight = t.fontHeight), t
						.lineWidth && (this._lineWidth = t.lineWidth), t.radius && (this._radius = t.radius),
						this._showAlert = "boolean" != typeof t.showAlert || t.showAlert, this._jsonMode =
						"boolean" != typeof t.jsonMode || t.jsonMode, this._showLog = "boolean" != typeof t
						.showLog || t.showLog, this._showHidPrinter = t.showHidPrinter
				}, n.prototype.logMsg = function(e) {
					for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
					if (this._showLog) {
						var r = Ie.formatDate();
						console.log("[".concat(r, "]: ").concat(e)), console.log.apply(console, t)
					}
				}, n.prototype.logObj = function(e) {
					this._showLog && console.log(e)
				}, n.prototype.setServerInfo = function(e) {
					var t;
					if (e) {
						if ((null === (t = e.selfIps) || void 0 === t ? void 0 : t.length) > 0)
							for (var n = 0, r = e.selfIps; n < r.length; n++) {
								var i = r[n];
								this._localIPs.add(i)
							}
						var a = (e.version || "").split("/");
						a.length > 1 && (this._version = a[1])
					}
				}, n.prototype.isLocalPrinter = function(e) {
					var t = "number" == typeof e ? e : (null == e ? void 0 : e.type) || 0;
					return this._version && this._version >= "2.3.2023.621" ? t < 10 : t <= 1
				}, n.prototype.checkPlugin = function(t) {
					var r = this,
						i = "function" == typeof t ? {
							callback: t
						} : t || {},
						a = function(t) {
							if (t.statusCode === e.LPA_Result.OK) console.log("★★★ 打印助手运行正常 ★★★");
							else if ((null == t ? void 0 : t.statusCode) === e.LPA_Result.NETWORK_ERROR &&
								"http:" === window.location.protocol) console.log(
								"★★★ 不安全网络[http]环境下需要禁用对本地服务的拦截操作 ★★★"), r._showAlert && window.prompt(
								"检测到不安全的网络环境，如果需要在 http 环境下继续使用打印助手，请打开浏览器，然后在浏览器的地址栏输入下列链接，然后将浏览器的 [Block insecure private network requests] 标志切换到【disable】:",
								n.URL_BLOCK_PRIVATE_NETWORK);
							else {
								console.log("★★★ 未检测到打印助手 ★★★");
								var a = r._downloadUrl || n.URL_DTPWEB_DOWNLOAD;
								r._showAlert && window.confirm("未检测到打印助手，是否要下载最新版本的打印助手？") && window.open(""
									.concat(a, "?protocol=").concat(window.location.protocol), "")
							}
							i.callback && i.callback(t)
						},
						o = {
							clientType: i.clientType
						};
					this.checkPort({
						port: R.PORT1,
						params: o,
						callback: function(t) {
							t.statusCode !== e.LPA_Result.OK ? t.statusCode === e.LPA_Result
								.NETWORK_ERROR && "http:" === window.location.protocol ? a(t) : r
								.checkPort({
									port: R.PORT2,
									params: o,
									callback: a
								}) : a(t)
						}
					})
				}, n.prototype.checkPort = function(t) {
					var n = this;
					this.logMsg("$$$$ DTPWEB request: checkPort(".concat(t.port, ") $$$$"));
					var r = this._initIp || R.IP,
						i = Ie.getParamString(t.params || {}),
						a = i ? "?".concat(i) : "";
					we || (we = this), Ie.request({
						host: r,
						port: t.port || this._port,
						url: "".concat(N, "/").concat(_e).concat(a),
						sync: !1,
						timeout: this.getTimeout(0)
					}, (function(i) {
						if (n.logMsg("#### onResponse: checkPort(".concat(t.port, ") ####"), i), i
							.statusCode < e.LPA_Result.NETWORK_FAILED) {
							var a = i.resultInfo;
							n._initIp || (n._initIp = r), t.port && (n._initPort = t.port), n
								.setServerInfo(a)
						}
						t.callback && t.callback(i)
					}))
				}, n.prototype.requestApi = function(t, n) {
					var r = this,
						i = Ie.getRequestData(["action"], [t]);
					this.logMsg("$$$$ DTPWEB request: ".concat(i.action, " $$$$"), i), n && this.logObj(n), n =
						n || {};
					var a = i.data || n.data;
					n.data && (n.data = void 0);
					var o = Ie.getParamString(i.params || n),
						s = o ? "?".concat(o) : "",
						u = i.control || I,
						l = this.getDeviceType(i.deviceType);
					this._Response = void 0, i.contentType === T.Json ? a = JSON.stringify(a || n) : i
						.contentType || (a = o);
					var c = Pe;
					i.contentType === T.Json ? c = Ae : i.contentType === T.Base64 ? c = ve : i.contentType ===
						T.Blob ? c = be : i.contentType === T.Hex16 ? c = Te : i.contentType === T.Lz77 ? c =
						Le : i.contentType === T.Binary && (c = Re);
					var h = this.isLocalPrinter(l) ? void 0 : i.ip,
						g = {
							statusCode: e.LPA_Result.WAIT_FOR_ASYNC,
							resultInfo: void 0
						};
					return Ie.request({
						method: "POST",
						host: this.getIpAddress(h),
						port: this.getPort(i.port),
						url: "".concat(u, "/").concat(i.action).concat(s),
						params: n,
						headers: {
							"Content-type": c
						},
						data: a,
						sync: !i.async,
						timeout: this.getTimeout(i.timeout, l)
					}, (function(e) {
						r.logMsg("#### onResponse: ".concat(i.action, " ####"), e), r._Response = e,
							i.callback && i.callback(e), g = e
					})), g
				}, n.prototype.getVersion = function(t) {
					var n = "number" == typeof t ? {
							clientType: t
						} : {},
						r = this.requestApi(w, n);
					return r.statusCode === e.LPA_Result.OK ? r.resultInfo : void 0
				}, n.prototype.getServerInfo = function(t) {
					var n = "number" == typeof t ? {
							clientType: t
						} : {},
						r = this.requestApi(_e, n);
					return r.statusCode === e.LPA_Result.OK ? r.resultInfo : void 0
				}, n.prototype.setSupportedPrinters = function(t) {
					if (Ie.isWindows()) return this.requestApi(E, {
						supportedPrinters: t
					}).statusCode === e.LPA_Result.OK
				}, n.prototype.getDefaultPrinter = function() {
					if (Ie.isWindows()) {
						var t = this.requestApi(D);
						return t.statusCode === e.LPA_Result.OK ? t.resultInfo : void 0
					}
				}, n.prototype.setDefaultPrinter = function(e) {
					Ie.isWindows() && this.requestApi(O, {
						printerName: e
					})
				}, n.prototype.discoveryPrinters = function(t) {
					return this.requestApi(C, {
						mode: null != t ? t : 1
					}).statusCode === e.LPA_Result.OK
				}, n.prototype.getPrinters = function(t, n) {
					var r, i = this,
						a = "function" == typeof t ? {
							callback: t
						} : t || {};
					a.onlyOnline = "boolean" != typeof a.onlyOnline || a.onlyOnline, a.onlySupported =
						"boolean" != typeof a.onlySupported || a.onlySupported;
					var o = this.requestApi({
							action: x,
							async: a.async,
							timeout: a.timeout || n || 5e3,
							callback: function(t) {
								var n = t.statusCode === e.LPA_Result.OK && t.resultInfo.printers || [];
								i._deviceList = i._showHidPrinter ? n : n.filter((function(e) {
									return 7 !== e.type && 5 !== e.type
								})), "function" == typeof a.callback && a.callback(i._deviceList)
							}
						}, a),
						s = (null === (r = o.resultInfo) || void 0 === r ? void 0 : r.printers) || [];
					return this._showHidPrinter ? s : s.filter((function(e) {
						return 7 !== e.type && 5 !== e.type
					}))
				}, n.prototype.getDeviceInfo = function(t) {
					var n = this.requestApi("GetDeviceInfo", {
						printerName: t
					});
					return n.statusCode === e.LPA_Result.OK ? n.resultInfo : {}
				}, n.prototype.openPrinter = function(t, n) {
					var r, i = this;
					"function" == typeof(r = "string" == typeof t ? /^\s*([A-Z]+[0-9]+)-([A-Z]?[0-9]{8,})\s*/
						.test(t) ? {
							deviceName: t
						} : {
							name: t
						} : "function" == typeof t ? {
							callback: t
						} : t || {}).callback && (n = r.callback);
					var a = this.requestApi({
						action: B,
						ip: r.ip || this._initIp,
						port: r.port || this._initPort,
						deviceType: r.type,
						async: "boolean" == typeof r.async && r.async,
						timeout: r.timeout || (r.async ? 1e4 : 5e3),
						callback: function(t) {
							if (t.statusCode === e.LPA_Result.OK) {
								i.isLocalPrinter(r.type) ? (i._ip = void 0, i._port = void 0) : (i
									._ip = r.ip, i._port = r.port);
								var a = r.name || r.deviceName || r.printerName;
								r.type && (i._deviceType = r.type), a && (i._deviceName = a)
							}
							n && n(t.statusCode === e.LPA_Result.OK)
						}
					}, r);
					return a.statusCode === e.LPA_Result.OK || a.statusCode === e.LPA_Result.WAIT_FOR_ASYNC
				}, n.prototype.getPrinterName = function() {
					return this.requestApi(j).resultInfo
				}, n.prototype.isPrinterOpened = function() {
					return this.requestApi(W).statusCode === e.LPA_Result.OK
				}, n.prototype.isPrinterOnline = function() {
					var t;
					return !!Ie.isWindows() && (null === (t = this.requestApi(M)) || void 0 === t ? void 0 : t
						.statusCode) === e.LPA_Result.OK
				}, n.prototype.closePrinter = function() {
					return this.requestApi(S).statusCode === e.LPA_Result.OK
				}, n.prototype.showProperty = function(t) {
					return !!Ie.isWindows() && (t.showDocument = "boolean" != typeof t.showDocument || t
						.showDocument, this.requestApi(H, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.getParam = function(t) {
					var n = Ie.getRequestData(["id"], [t]),
						r = this.requestApi(K, n);
					return r.statusCode === e.LPA_Result.OK ? r.resultInfo : -1
				}, n.prototype.setParam = function(t) {
					return t = Ie.getRequestData(["id", "value"], arguments), this.requestApi(V, t)
						.statusCode === e.LPA_Result.OK
				}, n.prototype.getGapType = function() {
					return this.getParam(e.LPA_ParamID.GapType)
				}, n.prototype.setGapType = function(t) {
					return this.setParam({
						id: e.LPA_ParamID.GapType,
						value: t
					})
				}, n.prototype.getPrintDarkness = function() {
					return this.getParam(e.LPA_ParamID.PrintDarkness)
				}, n.prototype.setPrintDarkness = function(t) {
					return this.setParam({
						id: e.LPA_ParamID.PrintDarkness,
						value: t
					})
				}, n.prototype.getPrintSpeed = function() {
					return this.getParam(e.LPA_ParamID.PrintSpeed)
				}, n.prototype.setPrintSpeed = function(t) {
					return this.setParam({
						id: e.LPA_ParamID.PrintSpeed,
						value: t
					})
				}, n.prototype.getPrinterDPI = function() {
					var t = this.requestApi(J);
					return t.statusCode === e.LPA_Result.OK ? t.resultInfo : void 0
				}, n.prototype.startJob = function(t) {
					var n = this;
					t = Ie.getRequestData(["width", "height", "orientation", "jobName"], arguments);
					var r = this.parseMarginAndOffset(t);
					this._labelWidth = t.width || R.LABEL_WIDTH, this._labelHeight = t.height || R.LABEL_HEIGHT,
						this._pageStartedFunc = t.pageStarted, this._pageEndedFunc = t.pageEnded, Ie.scaleUnit =
						this.IsJsonMode ? 0 : 1, t.scaleUnit = 1, t.width = Ie.unitConvert(t.width + r[1] + r[
							3]), t.height = Ie.unitConvert(t.height + r[0] + r[2]), t.jobName = t.jobName || e
						.LPA_JobNames.Print;
					var i = t.printerName || this._deviceName;
					if (!i && this._deviceList && this._deviceList.length > 0)
						for (var a = 0, o = this._deviceList; a < o.length; a++) {
							var s = o[a];
							if (this.isLocalPrinter(s)) {
								i = s.name;
								break
							}
						}
					if (this.jobPrintResult = void 0, this.jobStartInfo = {
							action: Ie.getJobAction(t.jobName, t.action),
							jobPages: [],
							jobInfo: {
								jobWidth: t.width,
								jobHeight: t.height,
								orientation: t.orientation,
								jobName: t.jobName
							},
							printerInfo: {
								printerName: i,
								printerDPI: t.printerDPI,
								printerWidth: t.printerWidth
							}
						}, this.IsJsonMode) return this.startPage();
					var u = this.requestApi({
						action: Y,
						callback: function(t) {
							t.statusCode === e.LPA_Result.OK && (n.pageInfo = [], n
								._pageStartedFunc && n._pageStartedFunc(n))
						}
					}, t);
					return u.statusCode === e.LPA_Result.OK || u.statusCode === e.LPA_Result.WAIT_FOR_ASYNC
				}, n.prototype.startPrintJob = function(e, r) {
					var i = this,
						a = e.jobName,
						o = "string" == typeof e.printer ? e.printer : e.printerName,
						s = "object" == typeof e.printer ? e.printer : {
							name: o
						};
					if (e.printerName || (e.printerName = s.name || this._deviceName), "function" == typeof e
						.callback && (r = e.callback), n.isPreviewJob(a) || this.IsJsonMode) {
						var u = this.startJob(e);
						return r && r(u), u
					}
					var l = this.openPrinter(t(t({}, s), {
						async: e.async,
						timeout: e.timeout,
						callback: function(t) {
							e.async && (t && i.startJob(e) ? r && r(!0) : r && r(!1))
						}
					}));
					return !!e.async || (l && this.startJob(e) ? (r && r(!0), !0) : (r && r(!1), !1))
				}, n.prototype.abortJob = function() {
					this.IsJsonMode || this.requestApi(Q)
				}, n.prototype.commitJob = function(r) {
					var i = this,
						a = "function" == typeof r ? {
							callback: r
						} : r || {};
					if (!this.jobStartInfo) return console.warn("===== 调用错误，未创建打印任务！====="), void(a.callback &&
						a.callback(void 0));
					a.jobArguments && (this.jobStartInfo.jobArguments = a.jobArguments, a.jobArguments =
						void 0), Object.assign(this.jobStartInfo.jobInfo, Ie.filterRecord(a, (function(e, t) {
							return "function" != typeof t
						})));
					var o = this.jobStartInfo.jobInfo,
						s = n.isPreviewJob(o.jobName);
					if ("number" == typeof a.darkness && (o.printDarkness = a.darkness), "number" == typeof a
						.speed && (o.printSpeed = a.speed), s || ("number" == typeof o.gapType && this
							.setGapType(o.gapType), "number" == typeof o.printDarkness && this.setPrintDarkness(
								o.printDarkness), "number" == typeof o.printSpeed && this.setPrintSpeed(o
								.printSpeed)), this.IsJsonMode) return this.endPage(), this.print(t(t({}, this
						.jobStartInfo), {
						async: a.async,
						callback: function(e) {
							i.jobPrintResult = e, a.callback && a.callback(e)
						}
					}));
					var u = {},
						l = this.requestApi({
							action: X,
							async: a.async,
							timeout: a.timeout || R.TIMEOUT_PRINT,
							callback: function(t) {
								if (i.pageInfo && (i.pageInfo = void 0, i._pageEndedFunc && i
										._pageEndedFunc(i)), t.statusCode !== e.LPA_Result.OK) a
									.callback && a.callback(void 0);
								else {
									if (s) {
										var n = i.getPageInfo();
										if (n) {
											u.width = n.width, u.height = n.height, u.previewData = [];
											for (var r = 0; r < n.pages; r++) {
												var o = i.getPageImage({
													page: r
												});
												u.previewData.push(o.data)
											}
										}
									}
									i.jobPrintResult = u, a.callback && a.callback(u)
								}
							}
						}, a);
					return l.statusCode === e.LPA_Result.OK || l.statusCode === e.LPA_Result.WAIT_FOR_ASYNC ?
						u : void 0
				}, n.prototype.setItemHorizontalAlignment = function(e) {
					return this.requestApi($, {
						alignment: e
					})
				}, n.prototype.setItemVerticalAlignment = function(e) {
					return this.requestApi(z, {
						alignment: e
					})
				}, n.prototype.setItemOrientation = function(e) {
					return this.requestApi(G, {
						orientation: e
					})
				}, n.prototype.getJobID = function() {
					return Ie.isWindows() ? this.requestApi(Z).resultInfo : 0
				}, n.prototype.getJobInfo = function(t) {
					if (Ie.isWindows()) {
						var n = this.requestApi(ee, t);
						return n.statusCode === e.LPA_Result.OK ? n.resultInfo : void 0
					}
				}, n.prototype.getPageInfo = function() {
					return this.jobPrintResult && this.jobPrintResult.previewData ? {
						width: this.jobPrintResult.width || 0,
						height: this.jobPrintResult.height || 0,
						pages: this.jobPrintResult.previewData.length || 0
					} : this.IsJsonMode ? {
						width: 0,
						height: 0,
						pages: 0
					} : this.requestApi(te).resultInfo
				}, n.prototype.getPageImage = function(e) {
					var t = (e = Ie.getRequestData(["page", "format"], arguments)).page || 0,
						n = this.jobPrintResult || {};
					return n.previewData && n.previewData[t] ? {
						page: t,
						data: n.previewData[t]
					} : this.IsJsonMode ? {
						page: t,
						data: ""
					} : this.requestApi(ne, e).resultInfo
				}, n.prototype.startPage = function() {
					if (!this.jobStartInfo) return !1;
					if (this.pageInfo && this.pageInfo.length <= 0) return !0;
					if (this.pageInfo && this.pageInfo.length > 0 && this.endPage(), this.pageInfo = [], this
						.IsJsonMode) return this._pageStartedFunc && this._pageStartedFunc(this), !0;
					var t = this.requestApi(re);
					return this._pageStartedFunc && this._pageStartedFunc(this), t.statusCode === e.LPA_Result
						.OK
				}, n.prototype.endPage = function() {
					if (!this.jobStartInfo || !this.pageInfo) return !1;
					if (this.pageInfo.length > 0 && this.jobStartInfo.jobPages.push(this.pageInfo), this
						.pageInfo = void 0, this.IsJsonMode) return this._pageEndedFunc && this._pageEndedFunc(
						this), !0;
					var t = this.requestApi(ie);
					return this._pageEndedFunc && this._pageEndedFunc(this), t.statusCode === e.LPA_Result.OK
				}, n.prototype.returnDrawResult = function(t) {
					var n, r = Ie.getRequestData(["returnDrawResult"], [t]);
					return r.returnDrawResult = null === (n = r.returnDrawResult) || void 0 === n || n, this
						.requestApi(ae, r).statusCode === e.LPA_Result.OK
				}, n.prototype.imageSrc2DataUrl = function(e, t) {
					Ie.loadImage(e, (function(e) {
						var n = e ? Ie.image2DataUrl(e) : void 0;
						t && t(n || "")
					}))
				}, n.prototype.mm2Pound = function(e) {
					return Ie.mmToPound(e)
				}, n.prototype.pound2Mm = function(e) {
					return Ie.poundToMm(e)
				}, n.prototype.pix2Mm = function(e, t) {
					return e / (t || 203) * 25.4
				}, n.prototype.mm2Pix = function(e, t) {
					return e / 25.4 * (t || 203)
				}, n.prototype.drawText = function(t) {
					return t = Ie.getRequestData(["text", "x", "y", "width", "height", "fontHeight",
						"fontStyle"], arguments), !(!this.pageInfo || !t.text) && (!t.fontHeight && t
						.fontSize ? t.fontHeight = this.pound2Mm(t.fontSize) : t.fontHeight = this
						.getFontHeight(t.fontHeight || t.height), t.fontName = this.getFontName(t.fontName),
						void 0 !== (t = Ie.unitConvertOfDrawBase(t, this._margins)).text && null !== t
						.text && "number" != typeof t.text && (t.text = "".concat(t.text)), Ie
						.checkTextOptions(t), this.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.Text
						})), !!this.IsJsonMode || this.requestApi(oe, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.measureText = function(t) {
					var n;
					if ((t = Ie.getRequestData(["text", "fontName", "fontHeight", "fontStyle"], arguments))
						.text) return void 0 !== t.text && null !== t.text && "number" != typeof t.text && (t
							.text = "".concat(t.text)), !t.fontHeight && t.fontSize ? t.fontHeight = this
						.pound2Mm(t.fontSize) : t.fontHeight = this.getFontHeight(t.fontHeight || t.height),
						t.fontName = this.getFontName(t.fontName), t.width = Ie.unitConvert(t.width), t
						.height = Ie.unitConvert(t.height), Ie.checkTextOptions(t), t.onlyMeasureText = !0,
						this.IsJsonMode ? (t.x && (t.x *= 100), t.y && (t.y *= 100), t.width && (t.width *=
								100), t.height && (t.height *= 100), t.fontHeight && (t.fontHeight *= 100),
							t.charSpace && (t.charSpace *= 100), "number" == typeof t.lineSpace && (t
								.lineSpace *= 100), this.requestApi(Y, {
								width: 4e3,
								height: 3e3,
								jobName: e.LPA_JobNames.Preview,
								scaleUnit: 1
							}), n = this.requestApi(oe, t), this.abortJob()) : n = this.requestApi(oe, t), n
						.statusCode === e.LPA_Result.OK ? n.resultInfo : void 0
				}, n.prototype.draw1DBarcode = function(t) {
					return t = Ie.getRequestData(["text", "x", "y", "width", "height", "textHeight"],
						arguments), !(!this.pageInfo || !t.text) && ((t = Ie.unitConvertOfDrawBase(t, this
								._margins)).textHeight = Ie.unitConvert(t.textHeight), t.textBarSpace = Ie
							.unitConvert(t.textBarSpace), t.fontName = this.getFontName(t.fontName), this
							.pageInfo.push(Object.assign(t, {
								type: e.LPA_DrawType.Barcode
							})), !!this.IsJsonMode || this.requestApi(se, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.draw2DQRCode = function(t) {
					return t = Ie.getRequestData(["text", "x", "y", "width", "height", "eccLevel"], arguments),
						!(!this.pageInfo || !t.text) && ((t = Ie.unitConvertOfDrawBase(t, this._margins))
							.height || (t.height = t.width), this.pageInfo.push(Object.assign(t, {
								type: e.LPA_DrawType.QRCode
							})), !!this.IsJsonMode || this.requestApi(ue, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.draw2DPdf417 = function(t) {
					return t = Ie.getRequestData(["text", "x", "y", "width", "height"], arguments), !(!this
						.pageInfo || !t.text) && (t = Ie.unitConvertOfDrawBase(t, this._margins), this
						.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.Pdf417
						})), !!this.IsJsonMode || this.requestApi(le, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.draw2DDataMatrix = function(t) {
					return t = Ie.getRequestData(["text", "x", "y", "width", "height"], arguments), !(!this
						.pageInfo || !t.text) && (t = Ie.unitConvertOfDrawBase(t, this._margins), this
						.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.DataMatrix
						})), !!this.IsJsonMode || this.requestApi(ce, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.drawRectangle = function(t) {
					return !!this.pageInfo && ((t = Ie.getRequestData(["x", "y", "width", "height",
							"lineWidth"], arguments)).cornerWidth || t.cornerHeight ? this
						.drawRoundRectangle(t) : (t.lineWidth = this.getLineWidth(t.lineWidth), t = Ie
							.unitConvertOfDrawRect(t, this._margins), this.pageInfo.push(Object.assign(t, {
								type: e.LPA_DrawType.Rect
							})), !!this.IsJsonMode || this.requestApi(he, t).statusCode === e.LPA_Result.OK)
						)
				}, n.prototype.drawRoundRectangle = function(t) {
					return !!this.pageInfo && ((t = Ie.getRequestData(["x", "y", "width", "height",
							"cornerWidth", "lineWidth"
						], arguments)).cornerWidth = this.getCornerWidth(t.cornerWidth || t.cornerHeight), t
						.lineWidth = this.getLineWidth(t.lineWidth), t = Ie.unitConvertOfDrawRect(t, this
							._margins), this.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.RoundRect
						})), !!this.IsJsonMode || this.requestApi(ge, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.drawEllipse = function(t) {
					return !!this.pageInfo && ((t = Ie.getRequestData(["x", "y", "width", "height",
							"lineWidth"], arguments)).lineWidth = this.getLineWidth(t.lineWidth), t = Ie
						.unitConvertOfDrawRect(t, this._margins), this.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.Ellipse
						})), !!this.IsJsonMode || this.requestApi(pe, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.drawCircle = function(e) {
					e = Ie.getRequestData(["x", "y", "radius", "lineWidth"], arguments);
					var t = this.getRadius(e.radius),
						n = 2 * t;
					delete e.radius;
					var r = e;
					return r.x = (e.x || 0) - t, r.y = (e.y || 0) - t, r.width = r.height = n, this.drawEllipse(
						r)
				}, n.prototype.drawLine = function(t) {
					return !!this.pageInfo && (((t = Ie.getRequestData(["x1", "y1", "x2", "y2", "lineWidth"],
							arguments)).dashLens || t.dashLen || []).length > 0 ? this.drawDashLine(t) : (t
							.lineWidth = this.getLineWidth(t.lineWidth), t = Ie.unitConvertOfLine(t, this
								._margins), this.pageInfo.push(Object.assign(t, {
								type: e.LPA_DrawType.Line
							})), !!this.IsJsonMode || this.requestApi(de, t).statusCode === e.LPA_Result.OK
							))
				}, n.prototype.drawDashLine = function(t) {
					return !!this.pageInfo && (((t = Ie.getRequestData(["x1", "y1", "x2", "y2", "dashLen",
							"lineWidth"
						], arguments)).dashLen || t.dashLens || []).length < 1 && (t.dashLens = R.DASH_LEN),
						t.lineWidth = this.getLineWidth(t.lineWidth), t = Ie.unitConvertOfLine(t, this
							._margins), this.pageInfo.push(Object.assign(t, {
							type: e.LPA_DrawType.DashLine
						})), !!this.IsJsonMode || this.requestApi(fe, t).statusCode === e.LPA_Result.OK)
				}, n.prototype.drawImage = function(n) {
					return !!this.pageInfo && (n = Ie.getRequestData(["imageFile", "x", "y", "width", "height"],
						arguments), !!(n = Ie.unitConvertOfDrawBase(n, this._margins)).imageFile && (
						this.IsJsonMode ? this._version && this._version < "2.6.20240730" && n.imageFile
						.length > 1048576 ? (console.warn("dtpweb 版本过低，图片URL字符串太长！"), !1) : (this
							.pageInfo.push(t(t({}, n), {
								type: e.LPA_DrawType.Image
							})), !0) : !(!n.imageFile || n.imageFile.length > 4096) && (this.pageInfo
							.push(n), this.requestApi(me, n).statusCode === e.LPA_Result.OK)))
				}, n.prototype.drawImageD = function(r) {
					var i, a = this;
					return !!this.pageInfo && ((r = Ie.getRequestData(["data", "x", "y", "drawWidth",
							"drawWidth"
						], arguments)).threshold = null !== (i = r.threshold) && void 0 !== i ? i : R
						.THRESHOLD, r.width || (r.width = r.drawWidth), r.height || (r.height = r
							.drawHeight), r.drawWidth || (r.drawWidth = r.width), r.drawHeight || (r
							.drawHeight = r.height), (r = Ie.unitConvertOfDrawBase(r, this._margins))
						.drawWidth = Ie.unitConvert(r.drawWidth || this._labelWidth), r.drawHeight = Ie
						.unitConvert(r.drawHeight || this._labelHeight), n.readAsDataURL(r.data, (function(
							n) {
							return r.data = n, !(!n || !a.pageInfo) && (a.IsJsonMode ? a._version &&
								a._version < "2.6.20240730" && n.length > 1048576 ? (console
									.warn("dtpweb 版本过低，BASE64字符串太大！"), !1) : (a.pageInfo.push(t(
									t({}, r), {
										data: void 0,
										imageFile: n,
										type: e.LPA_DrawType.Image
									})), !0) : (a.pageInfo.push(r), a.requestApi({
									action: ye,
									contentType: T.Base64,
									data: n
								}, r).statusCode === e.LPA_Result.OK))
						})))
				}, n.prototype.drawItem = function(t) {
					switch (t.type || (t.type = e.LPA_DrawType.Text), t.type) {
						case e.LPA_DrawType.Text:
							return this.drawText(t);
						case e.LPA_DrawType.Barcode:
							return this.draw1DBarcode(t);
						case e.LPA_DrawType.QRCode:
							return this.draw2DQRCode(t);
						case e.LPA_DrawType.Pdf417:
							return this.draw2DPdf417(t);
						case e.LPA_DrawType.DataMatrix:
							return this.draw2DDataMatrix(t);
						case e.LPA_DrawType.Image:
							return this.drawImage(t);
						case e.LPA_DrawType.Rect:
							return this.drawRectangle(t);
						case e.LPA_DrawType.RoundRect:
							return this.drawRoundRectangle(t);
						case e.LPA_DrawType.Ellipse:
							return this.drawEllipse(t);
						case e.LPA_DrawType.Line:
							return this.drawLine(t);
						case e.LPA_DrawType.DashLine:
							return this.drawDashLine(t);
						case e.LPA_DrawType.Table:
							return this.drawTable(t);
						default:
							return !1
					}
				}, n.prototype.drawTable = function(t) {
					var n = t || {},
						r = n,
						i = n.columnCount || 0;
					if ("number" != typeof n.lineWidth && (n.lineWidth = R.LINE_WIDTH), "number" == typeof r
						.columns && r.columns > 0 ? i = r.columns : "number" == typeof r.cols && r.cols > 0 && (
							i = r.cols), !n.tableRows || n.tableRows.length <= 0)
						if (Array.isArray(r.rows)) n.tableRows = r.rows;
						else if (Array.isArray(n.cells) && i > 0) {
						t.tableRows = [];
						for (var a = 0; a < n.cells.length; a += i) t.tableRows.push(n.cells.slice(a, a + i))
					}
					var o = this.jobStartInfo;
					if (!o) return !1;
					var s = "number" == typeof n.width ? n.width : o.jobInfo.jobWidth,
						u = "number" == typeof n.height ? n.height : o.jobInfo.jobHeight,
						l = n.tableRows || [];
					if (s <= 0 || u <= 0 || l.length <= 0) return !1;
					var c = n.lineWidth > 0 ? n.lineWidth : 0,
						h = n.cellPadding || 0,
						g = .5 * c,
						p = "number" == typeof n.horizontalAlignment ? n.horizontalAlignment : 1,
						d = "number" == typeof n.verticalAlignment ? n.verticalAlignment : 1,
						f = n.x || 0,
						m = n.y || 0,
						y = "number" == typeof n.rowCount && n.rowCount > 0 ? n.rowCount : 0,
						_ = i > 0 ? i : 0;
					y <= 0 && (y = "number" == typeof r.rows && r.rows > 0 ? r.rows : l.length), _ <= 0 && (_ =
						l.reduce((function(e, t) {
							return t && t.length > e ? t.length : e
						}), 0));
					var P = n.columnWidths && n.columnWidths.length > 1 ? n.columnWidths : Array(_).fill(.5);
					P.length > _ ? P = P.slice(0, _) : P.length < _ && (P = P.concat(Array(_ - P.length).fill(P[
						P.length - 1])));
					var A = (P = P.map((function(e) {
							return e > 0 ? e : .5
						}))).filter((function(e) {
							return e > 1
						})).reduce((function(e, t) {
							return e + t
						}), 0),
						v = P.filter((function(e) {
							return e <= 1
						})).reduce((function(e, t) {
							return e + t
						}), 0);
					v > 0 ? P = P.map((function(e) {
						return e > 1 ? e : (s - A) / v * e
					})) : A !== s && (P = P.map((function(e) {
						return e / A * s
					})));
					var T = n.rowHeights && n.rowHeights.length > 1 ? n.rowHeights : Array(y).fill(.5);
					T.length > y ? T = T.slice(0, y) : T.length < y && (T = T.concat(Array(y - T.length).fill(T[
						T.length - 1])));
					var b = (T = T.map((function(e) {
							return e > 0 ? e : .5
						}))).filter((function(e) {
							return e > 1
						})).reduce((function(e, t) {
							return e + t
						}), 0),
						L = T.filter((function(e) {
							return e <= 1
						})).reduce((function(e, t) {
							return e + t
						}), 0);
					L > 0 ? T = T.map((function(e) {
						return e > 1 ? e : (u - b) / L * e
					})) : b !== u && (T = T.map((function(e) {
						return e / b * u
					})));
					var I = n.groups ? n.groups.filter((function(e) {
						return e.width > 0 || e.height > 0
					})) : [];
					if (l.forEach((function(e, t) {
							for (var n = 0; n < _; n++) {
								var r = e[n];
								if ("object" == typeof r) {
									var i = r.rowSpan || 0,
										a = r.columnSpan || r.colSpan || 0;
									(i > 1 || a > 1) && I.push({
										x: n,
										y: t,
										width: a > 1 ? a : 1,
										height: i > 1 ? i : 1
									})
								}
							}
						})), I.length > 1) {
						var N = I.slice(0);
						I.splice(0);
						for (var w = [], E = 0, D = N; E < D.length; E++) {
							var O = D[E];
							if (!(w.indexOf(O) >= 0)) {
								var C = Ie.getUnionRectOfRelateRect(O, N, w);
								I.push(C)
							}
						}
					}
					c > 0 && this.drawRectangle({
						x: n.x,
						y: n.y,
						width: n.width,
						height: n.height,
						lineWidth: c
					});
					for (var x = 0, B = 0; x < y; B += T[x], x++)
						for (var S = l[x] || [], W = function(t, r) {
								var i = {
										x: t,
										y: x,
										width: 1,
										height: 1
									},
									a = I.filter((function(e) {
										return Ie.isInnerRect(i, e)
									})).shift();
								if (a) {
									if (i.x !== a.x || i.y !== a.y) return "continue";
									i.width = a.width, i.height = a.height
								}
								var o = function(e, t) {
										return (e || 0) + t
									},
									s = {
										x: f + r,
										y: m + B,
										width: i.width > 0 ? P.slice(i.x, i.x + i.width).reduce(o, 0) : P[i
											.x],
										height: i.height > 0 ? T.slice(i.y, i.y + i.height).reduce(o, 0) :
											T[i.y]
									};
								i.x > 0 && c > 0 && M.drawLine({
									x1: s.x,
									x2: s.x,
									y1: s.y + (i.y <= 0 ? g : 0),
									y2: s.y + s.height - (i.y + i.height >= y ? g : 0),
									lineWidth: c
								}), i.y > 0 && c > 0 && M.drawLine({
									x1: s.x + (i.x < 1 ? g : 0),
									x2: s.x + s.width - (i.x + i.width >= _ ? g : 0),
									y1: s.y,
									y2: s.y,
									lineWidth: c
								});
								var u = S[t];
								if (void 0 !== u) {
									var l = u;
									"object" != typeof u && (l = {
										text: u
									}), l.type || (l.type = e.LPA_DrawType.Text);
									var A = l,
										v = l;
									"number" != typeof v.horizontalAlignment && (v.horizontalAlignment = p),
										"number" != typeof v.verticalAlignment && (v.verticalAlignment = d);
									var b = g + h;
									if ("number" == typeof A.margin && (b += A.margin), l.type === e
										.LPA_DrawType.Text) {
										var L = l;
										L.fontHeight || (L.fontHeight = n.fontHeight || .3 * s.height), !L
											.fontName && n.fontName && (L.fontName = n.fontName),
											"number" != typeof L.fontStyle && "number" == typeof n
											.fontStyle && (L.fontStyle = n.fontStyle)
									}
									M.drawItem(Object.assign(l, Ie.shrinkCellContent(s, b)))
								}
							}, M = this, j = 0, H = 0; j < _; H += P[j], j++) W(j, H);
					return !0
				}, n.prototype.printImage = function(t) {
					var r = this;
					return (t = Ie.getRequestData(["data", "printerName"], arguments)).data ? n.readAsDataURL(t
						.data, (function(n) {
							var i;
							if (n) {
								var a = "number" == typeof t.scaleUnit ? t.scaleUnit : 2;
								(a > 2 || a < 0) && (a = 2), 2 === a && (a = 1, t.printWidth && (t
											.printWidth *= 100), t.printHeight && (t.printHeight *=
										100)), t.data = n, t.scaleUnit = a, t.threshold = null !== (i =
										t.threshold) && void 0 !== i ? i : R.THRESHOLD, t.jobName = t
									.jobName || e.LPA_JobNames.Print;
								var o = r.requestApi({
									action: k,
									contentType: T.Base64,
									data: n,
									async: t.async,
									timeout: t.timeout || R.TIMEOUT_PRINT,
									callback: function(n) {
										t.callback && t.callback(n.statusCode === e
											.LPA_Result.OK)
									}
								}, t);
								return o.statusCode === e.LPA_Result.OK || o.statusCode === e.LPA_Result
									.WAIT_FOR_ASYNC
							}
							return t.callback && t.callback(!1), !1
						})) : (t.callback && t.callback(!1), !1)
				}, n.prototype.printRawData = function(r) {
					if (!(r = Ie.getRequestData(["data"], arguments)).data) return r.callback && r.callback(!1),
						!1;
					var i = T.Blob;
					"string" == typeof r.data && (i = n.isBase64Str(r.data) ? T.Base64 : T.Hex16);
					var a = this.requestApi({
						action: U,
						contentType: i,
						data: r.data,
						async: r.async,
						timeout: r.timeout || R.TIMEOUT_PRINT,
						callback: function(t) {
							r.callback && r.callback(t.statusCode === e.LPA_Result.OK)
						}
					}, t(t({}, r), {
						data: void 0
					}));
					return a.statusCode === e.LPA_Result.OK || a.statusCode === e.LPA_Result.WAIT_FOR_ASYNC
				}, n.prototype.printPackage = function(r) {
					if (!(r = Ie.getRequestData(["data"], arguments)).data) return r.callback && r.callback(!1),
						!1;
					var i = T.Blob;
					"string" == typeof r.data && (i = n.isBase64Str(r.data) ? T.Base64 : T.Hex16);
					var a = this.requestApi({
						action: F,
						contentType: i,
						data: r.data,
						async: r.async,
						timeout: r.timeout || R.TIMEOUT_PRINT,
						callback: function(t) {
							r.callback && r.callback(t.statusCode === e.LPA_Result.OK)
						}
					}, t(t({}, r), {
						data: void 0
					}));
					return a.statusCode === e.LPA_Result.OK || a.statusCode === e.LPA_Result.WAIT_FOR_ASYNC
				}, n.prototype.print = function(t) {
					var n, r;
					if ((t = "string" == typeof t ? {
							content: t
						} : t || {}).content && delete(t = Object.assign({}, JSON.parse(t.content), t)).content,
						t.jobArguments && t.jobArguments.length > 0)
						for (var i = function(e) {
								var n = t.jobArguments[e];
								if (!Array.isArray(n) && "object" == typeof n) {
									var r = [];
									Object.keys(n).forEach((function(e) {
										r.push({
											k: e,
											v: n[e]
										})
									})), t.jobArguments[e] = r
								}
							}, a = 0; a < t.jobArguments.length; a++) i(a);
					var o = t.action || R.PRINT_ACTION,
						s = t.jobInfo || {};
					if (t.action && delete t.action, s.copies && s.copies > 1) {
						var u = t.jobPages.slice(0);
						if (!s.autoPage && u.length > 1) {
							t.jobPages.splice(0);
							for (var l = 0, c = u; l < c.length; l++) {
								var h = c[l];
								(n = t.jobPages).push.apply(n, Array(s.copies).fill(h))
							}
						} else
							for (a = 1; a < s.copies; a++)(r = t.jobPages).push.apply(r, u)
					}
					var g = this.requestApi({
						action: q,
						contentType: T.Json,
						params: {
							action: o
						},
						data: t,
						async: t.async,
						timeout: t.timeout || R.TIMEOUT_PRINT,
						callback: function(n) {
							var r = (null == n ? void 0 : n.statusCode) === e.LPA_Result.OK ? n
								.resultInfo : void 0;
							t.callback && t.callback(r)
						}
					});
					return g.statusCode === e.LPA_Result.OK ? g.resultInfo : void 0
				}, n.prototype.printWdfx = function(e) {
					var n = e || {},
						r = n.action || 0,
						i = Ie.parseWdfxString(e.content);
					if (!i) return console.warn("---- wdfx内容解析错误："), console.warn(e.content), void(e.callback &&
						e.callback(void 0));
					var a = !!(134 & r),
						o = Ne.parseLPAPIElement(i);
					n.jobInfo && Object.assign(o, n.jobInfo);
					var s = o.background;
					o.background && (o.background = void 0);
					var u = o;
					if (Object.keys(o).forEach((function(e) {
							null !== u[e] && void 0 !== u[e] || delete u[e]
						})), o.jobWidth <= 0 || o.jobHeight <= 0) e.callback && e.callback(void 0);
					else {
						var l = Ie.getElementByTagName(i, L.Page);
						if (!l || l.childElementCount <= 0) e.callback && e.callback(void 0);
						else {
							this.startJob(t(t({}, o), {
								width: o.jobWidth,
								height: o.jobHeight,
								orientation: o.orientation,
								action: n.action
							})), a && s && this.drawImage({
								imageFile: s,
								x: 0,
								y: 0,
								width: o.jobWidth,
								height: o.jobHeight
							});
							for (var c = 0; c < l.children.length; c++) {
								var h = l.children[c],
									g = void 0;
								h.tagName === L.Text || h.tagName === L.String ? g = Ne.parseTextElement(h,
										void 0, "双击输入内容") : h.tagName === L.Barcode ? g = Ne
									.parse1DBarcodeElement(h) : h.tagName === L.Qrcode ? g = Ne
									.parse2DBarcodeElement(h) : h.tagName === L.Time || h.tagName === L.Date ?
									g = Ne.parseDateTimeElement(h) : h.tagName === L.Image || h.tagName === L
									.Photo || h.tagName === L.Logo ? g = Ne.parseImageElement(h) : h.tagName ===
									L.Rectangle || h.tagName === L.Rect || h.tagName === L.Circle || h
									.tagName === L.Ellipse ? g = Ne.parseRectangleElement(h) : h.tagName === L
									.Line ? g = Ne.parseLineElement(h) : h.tagName === L.Table ? g = Ne
									.parseTableElement(h) : console.warn("----不支持的绘制内容：".concat(h.tagName)),
									g && this.drawItem(g)
							}
							this.commitJob(t(t({}, o), {
								jobArguments: n.jobArguments,
								orientation: o.orientation,
								async: e.async,
								timeout: e.timeout || R.TIMEOUT_PRINT,
								callback: n.callback
							}))
						}
					}
				}, n.URL_DTPWEB_DOWNLOAD = "https://weida.dothantech.com/assets/dtpweb/index.html", n
				.URL_BLOCK_PRIVATE_NETWORK = "chrome://flags/#block-insecure-private-network-requests", n
		}();
	e.DTPWeb = Ee, e.checkServer = function(e) {
		return Ee.checkServer(e)
	}, e.getInstance = function(e) {
		return Ee.getInstance(e)
	}, Object.defineProperty(e, "__esModule", {
		value: !0
	})
}));